import java.util.*;
public class TestDemo {
/*    public static String reverse(String S) {
        String[] strs = S.trim().split(" ");
        StringBuilder sb = new StringBuilder();
        for (int i = strs.length - 1; i >= 0; i--) {
            sb.append(strs[i]);
            sb.append(" ");
        }
        return sb.toString().trim();
    }*/
/*public static int minInt(int[] arr) {
    int len = arr.length;
    for (int i = 0; i < len; i++){
        if (arr[i] > 0 && arr[i] < len) {
            int tmp = arr[arr[i]-1];
            arr[arr[i]-1] = arr[i];
            arr[i] = tmp;
        }
    }

    for (int i = 0;i < len; i++) {
        if (arr[i] != i+1) {
            return i+1;
        }
    }
    return len+1;
}*/
    // 用数组实现栈，缺点是数组的大小已经固定。因此栈的最大容量也已经确定。
/*    class Stack {

        int[] stack;
        int i;
        public Stack() {
            stack = new int[1000];
            i = 0;
        }

        public void push(int x) {
            stack[i++] = x;
        }

        public int pop() {
            return stack[i--];
        }

        public int top() {
            return stack[i];
        }

        public int size() {
            return i+1;
        }
    }*/




    public class MaxTree {

        private static int[] oddArr;

        private static int[] evenArr;



        public static int[] getLongestTreeSequence(int[] arr, List<Integer> cutTreeList) {



            PriorityQueue<Integer> queue = new PriorityQueue<>();

            for (int i = 0; i < arr.length; i++) {

                queue.add(arr[i]);

            }

            Collections.sort(cutTreeList);

            int pos = -1;

            int longest = 0;

            int i = 0;

            while (!queue.isEmpty() && i < cutTreeList.size()) {

                int cutTreeVal = cutTreeList.get(i);

                int curLen = 0;

                int curPos = queue.peek();

                while (!queue.isEmpty() && queue.peek() < cutTreeVal) {

                    queue.poll();

                    curLen++;

                }

                if (!queue.isEmpty() && cutTreeVal == queue.peek()) {

                    queue.poll();

                }

                if (curLen > longest) {

                    pos = curPos;

                    longest = curLen;

                }

                i++;

            }

            if (!queue.isEmpty()) {

                if (queue.size() > longest) {

                    pos = queue.peek();

                    longest = queue.size();

                }

            }

            int[] ret = new int[2];

            ret[0] = pos;

            ret[1] = longest;

            return ret;

        }



        public static void main(String[] args) {

            Scanner in = new Scanner(System.in);

            int[] oddArr = new int[50];

            oddArr[0] = 1;

            for (int i = 2; i <= 50; i++) {

                oddArr[i - 1] = 2 * i - 1;

            }

            int[] evenArr = new int[50];

            for (int j = 1; j <= 50; j++) {

                evenArr[j - 1] = j * 2;

            }

            while (in.hasNext()) {

                String input1 = in.nextLine();

                int N = Integer.parseInt(input1);

                String input2 = in.nextLine();

                String[] cutTrees = input2.split(" ");

                List<Integer> oddList = new ArrayList<>();

                List<Integer> evenList = new ArrayList<>();

                for (int j = 0; j < cutTrees.length; j++) {

                    int temp = Integer.parseInt(cutTrees[j]);

                    if ((temp & 1) == 0) {

                        evenList.add(temp);

                    } else {

                        oddList.add(temp);

                    }

                }

                int[] oddLongest = getLongestTreeSequence(oddArr, oddList);

                int[] evenLongedt = getLongestTreeSequence(evenArr, evenList);

                if (oddLongest[1] > evenLongedt[1]) {

                    System.out.print(oddLongest[0] + " " + oddLongest[1]);

                } else if (oddLongest[1] < evenLongedt[1]) {

                    System.out.print(evenLongedt[0] + " " + evenLongedt[1]);
                } else {

                    if (evenLongedt[0] < oddLongest[0]) {

                        System.out.print(evenLongedt[0] + " " + evenLongedt[1]);

                    } else {
                        System.out.print(oddLongest[0] + " " + oddLongest[1]);

                    }

                }

            }

        }

    }
}
